#!/bin/bash
read -p "服务名称："  name
if ps -elf | grep "$name" | grep -v "grep" &>/dev/null ; then
#PID
   pid=$(pidof $name)
#启动时间
   start_time=$(ps -p "$pid"  -o lstart=)
#端口
   net=$(netstat -tunlp | grep "$name" | awk '{print $4}'  | awk -F: '{print $NF}')
   echo "服务名称："$name", PID："$pid",  启动时间："$start_time""
else 
   echo "此进程未启动"
fi
